import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '系统名',
    align: "center",
    sorter: true,
    dataIndex: 'systemName'
  },
  {
    title: '所属项目',
    align: "center",
    sorter: true,
    dataIndex: 'projectId_dictText'
  },
  // {
  //   title: '系统编码',
  //   align: "center",
  //   sorter: true,
  //   dataIndex: 'systemCode'
  // },
  // {
  //   title: '系统三位简称',
  //   align: "center",
  //   sorter: true,
  //   dataIndex: 'systemAbbr'
  // },
  {
    title: '项目经理',
    align: "center",
    sorter: true,
    dataIndex: 'projectManage_dictText'
  },
  {
    title: '测试负责人',
    align: "center",
    sorter: true,
    dataIndex: 'testManage_dictText'
  },
  {
    title: '开发负责人',
    align: "center",
    sorter: true,
    dataIndex: 'devManage_dictText'
  },
  {
    title: '产品负责人',
    align: "center",
    sorter: true,
    dataIndex: 'productManage_dictText'
  },
  {
    title: '描述',
    align: "center",
    dataIndex: 'description'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '创建时间',
    align: "center",
    sorter: true,
    dataIndex: 'createTime'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '更新时间',
    align: "center",
    sorter: true,
    dataIndex: 'updateTime'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "系统名",
    field: 'systemName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "所属项目",
    field: 'projectId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tm_project,project_name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "系统编码",
    field: 'systemCode',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "系统三位简称",
    field: 'systemAbbr',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "项目经理",
    field: 'projectManage',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,username"
    },
    //colProps: {span: 6},
  },
  {
    label: "测试负责人",
    field: 'testManage',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,username"
    },
    //colProps: {span: 6},
  },
  {
    label: "开发负责人",
    field: 'devManage',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,username"
    },
    //colProps: {span: 6},
  },
  {
    label: "产品负责人",
    field: 'productManage',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,username"
    },
    //colProps: {span: 6},
  },
  {
    label: "描述",
    field: 'description',
    component: 'Input',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '系统名',
    field: 'systemName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入系统名!'},
             ];
    },
  },
  {
    label: '所属项目',
    field: 'projectId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tm_project,project_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入所属项目!'},
             ];
    },
  },
  {
    label: '系统编码',
    field: 'systemCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入系统编码!'},
             ];
    },
  },
  {
    label: '系统三位简称',
    field: 'systemAbbr',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入系统三位简称!'},
             ];
    },
  },
  {
    label: '项目经理',
    field: 'projectManage',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,username"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目经理!'},
             ];
    },
  },
  {
    label: '测试负责人',
    field: 'testManage',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,username"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入测试负责人!'},
             ];
    },
  },
  {
    label: '开发负责人',
    field: 'devManage',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,username"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入开发负责人!'},
             ];
    },
  },
  {
    label: '产品负责人',
    field: 'productManage',
    component: 'JSearchSelect',
    componentProps:{
      dict: "sys_user,realname,username"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入产品负责人!'},
             ];
    },
  },
  {
    label: '描述',
    field: 'description',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  systemName: {title: '系统名',order: 0,view: 'text', type: 'string',},
  projectId: {title: '所属项目',order: 1,view: 'list', type: 'string',dictTable: "tm_project", dictCode: 'id', dictText: 'project_name',},
  systemCode: {title: '系统编码',order: 2,view: 'text', type: 'string',},
  systemAbbr: {title: '系统三位简称',order: 3,view: 'text', type: 'string',},
  projectManage: {title: '项目经理',order: 4,view: 'sel_search', type: 'string',dictTable: "sys_user", dictCode: 'username', dictText: 'realname',},
  testManage: {title: '测试负责人',order: 5,view: 'sel_search', type: 'string',dictTable: "sys_user", dictCode: 'username', dictText: 'realname',},
  devManage: {title: '开发负责人',order: 6,view: 'sel_search', type: 'string',dictTable: "sys_user", dictCode: 'username', dictText: 'realname',},
  productManage: {title: '产品负责人',order: 7,view: 'sel_search', type: 'string',dictTable: "sys_user", dictCode: 'username', dictText: 'realname',},
  description: {title: '描述',order: 8,view: 'textarea', type: 'string',},
  createBy: {title: '创建人',order: 9,view: 'text', type: 'string',},
  createTime: {title: '创建时间',order: 10,view: 'datetime', type: 'string',},
  updateBy: {title: '更新人',order: 11,view: 'text', type: 'string',},
  updateTime: {title: '更新时间',order: 12,view: 'datetime', type: 'string',},
};
